package com.aspose.cells;

public class TrendlineCollection extends CollectionBase {
   private Series b;

   TrendlineCollection(Series parent) {
      this.b = parent;
   }

   public int add(int type) {
      Trendline var2 = new Trendline(this.b, type);
      com.aspose.cells.b.a.a.ze.a(this.a, (Object)var2);
      return this.getCount() - 1;
   }

   int a(int var1) {
      Trendline var2 = new Trendline(this.b, var1);
      Chart var10001 = this.b.h().d();
      int var10003 = var10001.e;
      Chart var10002 = var10001;
      int var3 = var10001.e;
      var10002.e = var10003 + 1;
      var2.p(var3);
      com.aspose.cells.b.a.a.ze.a(this.a, (Object)var2);
      return this.getCount() - 1;
   }

   public int add(int type, String name) {
      if (name != null && !"".equals(name)) {
         if (name.length() > 255) {
            throw new IllegalArgumentException("Too long name.");
         } else {
            Trendline var3 = new Trendline(this.b, type, name);
            Chart var10001 = this.b.h().d();
            int var10003 = var10001.e;
            Chart var10002 = var10001;
            int var4 = var10001.e;
            var10002.e = var10003 + 1;
            var3.p(var4);
            com.aspose.cells.b.a.a.ze.a(this.a, (Object)var3);
            return this.getCount() - 1;
         }
      } else {
         return this.add(type);
      }
   }

   public Trendline get(int index) {
      return (Trendline)this.a.get(index);
   }

   void a(Trendline var1) {
      com.aspose.cells.b.a.a.ze.a(this.a, (Object)var1);
   }

   void a(TrendlineCollection var1) {
      for(int var2 = 0; var2 < var1.getCount(); ++var2) {
         Trendline var3 = new Trendline(this.b, var1.get(var2).getType(), var1.get(var2).getName());
         com.aspose.cells.b.a.a.ze.a(this.a, (Object)var3);
         var3.a(var1.get(var2));
      }

   }
}
